﻿<?php
include 'conn_mysql.php';//链接数据库配置
session_start();
$bigtype=$_REQUEST['bigtype'];

//提交信息
if($bigtype==1){
	$id=$_REQUEST['id'];
	
	$difang_type=$_REQUEST['difang_type'];
	$biaoti=$_REQUEST['biaoti'];
	$jitian=$_REQUEST['jitian'];
	$fanduos=$_REQUEST['fanduos'];
	$danfangcha=$_REQUEST['danfangcha'];
	
	$banqi1=$_REQUEST['banqi1'];
	$chengren1=$_REQUEST['chengren1'];
	$ertong1=$_REQUEST['ertong1'];
	$up_renshu1=$_REQUEST['up_renshu1'];
	$banqi2=$_REQUEST['banqi2'];
	$chengren2=$_REQUEST['chengren2'];
	$ertong2=$_REQUEST['ertong2'];
	$up_renshu2=$_REQUEST['up_renshu2'];
	$banqi3=$_REQUEST['banqi3'];
	$chengren3=$_REQUEST['chengren3'];
	$ertong3=$_REQUEST['ertong3'];
	$up_renshu3=$_REQUEST['up_renshu3'];

	$banqi4=$_REQUEST['banqi4'];
	$chengren4=$_REQUEST['chengren4'];
	$ertong4=$_REQUEST['ertong4'];
	$up_renshu4=$_REQUEST['up_renshu4'];
	$banqi5=$_REQUEST['banqi5'];
	$chengren5=$_REQUEST['chengren5'];
	$ertong5=$_REQUEST['ertong5'];
	$up_renshu5=$_REQUEST['up_renshu5'];
	$banqi6=$_REQUEST['banqi6'];
	$chengren6=$_REQUEST['chengren6'];
	$ertong6=$_REQUEST['ertong6'];
	$up_renshu6=$_REQUEST['up_renshu6'];
	
	$is_open=$_REQUEST['is_open'];
	$sort=$_REQUEST['sort']?intval($_REQUEST['sort']):0;
	$is_hidden=$_REQUEST['is_hidden']?intval($_REQUEST['is_hidden']):0;
	$is_hot=$_REQUEST['is_hot']?intval($_REQUEST['is_hot']):0;
	$difang_type_region=$_REQUEST['difang_type_region']?intval($_REQUEST['difang_type_region']):0;

	
	//判断该用户是否存在
	if(strlen($id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `lvyou_difang_info`(`biaoti`,`jitian`, `fanduos`,`difang_type`,`danfangcha`,`banqi1`,`chengren1`,`ertong1`,`up_renshu1`,`banqi2`,`chengren2`,`ertong2`,`up_renshu2`,`banqi3`,`chengren3`,`ertong3`,`up_renshu3`,`is_open`,`sort`,`is_hidden`,`banqi4`,`chengren4`,`ertong4`,`up_renshu4`,`banqi5`,`chengren5`,`ertong5`,`up_renshu5`,`banqi6`,`chengren6`,`ertong6`,`up_renshu6`,`is_hot`,`difang_type_region`)";
		$sql.=" VALUES ('$biaoti','$jitian','$fanduos','$difang_type','$danfangcha','$banqi1','$chengren1','$ertong1','$up_renshu1','$banqi2','$chengren2','$ertong2','$up_renshu2','$banqi3','$chengren3','$ertong3','$up_renshu3','$is_open','$sort','$is_hidden','$banqi4','$chengren4','$ertong4','$up_renshu4','$banqi5','$chengren5','$ertong5','$up_renshu5','$banqi6','$chengren6','$ertong6','$up_renshu6','$is_hot','$difang_type_region')";
		$query = mysql_query($sql);
		
		//查询用户分配到的id
		$sql="select * from `lvyou_difang_info` where biaoti='$biaoti'";
		$query = mysql_query($sql);
		while($row = mysql_fetch_array($query)){
			$id=$row['id'];
		}

	
	}else{
		//账号存在，更新数据
		$sql="UPDATE `lvyou_difang_info` SET `biaoti`='$biaoti',`jitian`='$jitian',`fanduos`='$fanduos',`difang_type`='$difang_type',`danfangcha`='$danfangcha',`banqi1`='$banqi1',`chengren1`='$chengren1',`ertong1`='$ertong1',`banqi2`='$banqi2',`chengren2`='$chengren2',`ertong2`='$ertong2',`banqi3`='$banqi3',`chengren3`='$chengren3',`ertong3`='$ertong3',`up_renshu1`='$up_renshu1',`up_renshu2`='$up_renshu2',`up_renshu3`='$up_renshu3',`is_open`='$is_open',`sort`='$sort',`is_hidden`='$is_hidden',`banqi4`='$banqi4',`chengren4`='$chengren4',`ertong4`='$ertong4',`up_renshu4`='$up_renshu4',`banqi5`='$banqi5',`chengren5`='$chengren5',`ertong5`='$ertong5',`up_renshu5`='$up_renshu5' ,`banqi6`='$banqi6',`chengren6`='$chengren6',`ertong6`='$ertong6',`up_renshu6`='$up_renshu6',`is_hot`='$is_hot',`difang_type_region`='$difang_type_region'  WHERE id='$id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}

if($bigtype==2){
	$id_self=$_REQUEST['id_self'];
	
	$sql="DELETE FROM `main_user` WHERE id_self='$id_self'";
	$query = mysql_query($sql);
	echo "{";
	echo "\"code\"".":"."\"0001\"";
	echo "}";
	exit;
}

if($bigtype==3){
	$id=$_REQUEST['id'];
	
	$duanluo1=$_REQUEST['duanluo1'];
	$duanluo2=$_REQUEST['duanluo2'];
	$duanluo3=$_REQUEST['duanluo3'];
	$duanluo4=$_REQUEST['duanluo4'];
	
	$sunxv1=$_REQUEST['sunxv1'];
	$sunxv2=$_REQUEST['sunxv2'];
	$sunxv3=$_REQUEST['sunxv3'];
	$sunxv4=$_REQUEST['sunxv4'];
	
	//将原先存在的段落删除，再上传新的段落
	$sql="DELETE FROM `difang_duanluo` WHERE difang_id='$id'";
	$query = mysql_query($sql);
	
	$sql="INSERT INTO `difang_duanluo`(`difang_id`, `duanluo`, `youxianji`) VALUES ('$id','$duanluo1','$sunxv1')";
	$query = mysql_query($sql);
	$sql="INSERT INTO `difang_duanluo`(`difang_id`, `duanluo`, `youxianji`) VALUES ('$id','$duanluo2','$sunxv2')";
	$query = mysql_query($sql);
	$sql="INSERT INTO `difang_duanluo`(`difang_id`, `duanluo`, `youxianji`) VALUES ('$id','$duanluo3','$sunxv3')";
	$query = mysql_query($sql);
	$sql="INSERT INTO `difang_duanluo`(`difang_id`, `duanluo`, `youxianji`) VALUES ('$id','$duanluo4','$sunxv4')";
	$query = mysql_query($sql);
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."线路特色上传成功"."\"";
	echo "}";
	exit;
}
//提交第一天信息
if($bigtype==4){
	$id=$_REQUEST['id'];
	$day=$_REQUEST['day'];
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng1_biaoti=$_REQUEST['xingcheng1_biaoti'];
	$xingcheng1_type1=$_REQUEST['xingcheng1_type1'];
	$xingcheng1_nairong1=$_REQUEST['xingcheng1_nairong1'];
	$xingcheng1_type2=$_REQUEST['xingcheng1_type2'];
	$xingcheng1_nairong2=$_REQUEST['xingcheng1_nairong2'];
	$xingcheng1_type3=$_REQUEST['xingcheng1_type3'];
	$xingcheng1_nairong3=$_REQUEST['xingcheng1_nairong3'];
	$xingcheng1_type4=$_REQUEST['xingcheng1_type4'];
	$xingcheng1_nairong4=$_REQUEST['xingcheng1_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng1_biaoti','$xingcheng1_type1','$xingcheng1_nairong1','$xingcheng1_type2','$xingcheng1_nairong2','$xingcheng1_type3','$xingcheng1_nairong3','$xingcheng1_type4','$xingcheng1_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng1_biaoti',`tubiao_type1`='$xingcheng1_type1',`nairong1`='$xingcheng1_nairong1',`tubiao_type2`=$xingcheng1_type2,`nairong2`='$xingcheng1_nairong2',`tubiao_type3`='$xingcheng1_type3',`nairong3`='$xingcheng1_nairong3',`tubiao_type4`='$xingcheng1_type4',`nairong4`='$xingcheng1_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"day\"".":"."\"".$day."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第二天信息
if($bigtype==5){
	$id=$_REQUEST['id'];
	$day=2;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng2_biaoti=$_REQUEST['xingcheng2_biaoti'];
	$xingcheng2_type1=$_REQUEST['xingcheng2_type1'];
	$xingcheng2_nairong1=$_REQUEST['xingcheng2_nairong1'];
	$xingcheng2_type2=$_REQUEST['xingcheng2_type2'];
	$xingcheng2_nairong2=$_REQUEST['xingcheng2_nairong2'];
	$xingcheng2_type3=$_REQUEST['xingcheng2_type3'];
	$xingcheng2_nairong3=$_REQUEST['xingcheng2_nairong3'];
	$xingcheng2_type4=$_REQUEST['xingcheng2_type4'];
	$xingcheng2_nairong4=$_REQUEST['xingcheng2_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng2_biaoti','$xingcheng2_type1','$xingcheng2_nairong1','$xingcheng2_type2','$xingcheng2_nairong2','$xingcheng2_type3','$xingcheng2_nairong3','$xingcheng2_type4','$xingcheng2_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng2_biaoti',`tubiao_type1`='$xingcheng2_type1',`nairong1`='$xingcheng2_nairong1',`tubiao_type2`=$xingcheng2_type2,`nairong2`='$xingcheng2_nairong2',`tubiao_type3`='$xingcheng2_type3',`nairong3`='$xingcheng2_nairong3',`tubiao_type4`='$xingcheng2_type4',`nairong4`='$xingcheng2_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第三天信息
if($bigtype==6){
	$id=$_REQUEST['id'];
	$day=3;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng3_biaoti=$_REQUEST['xingcheng3_biaoti'];
	$xingcheng3_type1=$_REQUEST['xingcheng3_type1'];
	$xingcheng3_nairong1=$_REQUEST['xingcheng3_nairong1'];
	$xingcheng3_type2=$_REQUEST['xingcheng3_type2'];
	$xingcheng3_nairong2=$_REQUEST['xingcheng3_nairong2'];
	$xingcheng3_type3=$_REQUEST['xingcheng3_type3'];
	$xingcheng3_nairong3=$_REQUEST['xingcheng3_nairong3'];
	$xingcheng3_type4=$_REQUEST['xingcheng3_type4'];
	$xingcheng3_nairong4=$_REQUEST['xingcheng3_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng3_biaoti','$xingcheng3_type1','$xingcheng3_nairong1','$xingcheng3_type3','$xingcheng3_nairong2','$xingcheng3_type3','$xingcheng3_nairong3','$xingcheng3_type4','$xingcheng3_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng3_biaoti',`tubiao_type1`='$xingcheng3_type1',`nairong1`='$xingcheng3_nairong1',`tubiao_type2`=$xingcheng3_type2,`nairong2`='$xingcheng3_nairong2',`tubiao_type3`='$xingcheng3_type3',`nairong3`='$xingcheng3_nairong3',`tubiao_type4`='$xingcheng3_type4',`nairong4`='$xingcheng3_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第四天信息
if($bigtype==7){
	$id=$_REQUEST['id'];
	$day=4;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng4_biaoti=$_REQUEST['xingcheng4_biaoti'];
	$xingcheng4_type1=$_REQUEST['xingcheng4_type1'];
	$xingcheng4_nairong1=$_REQUEST['xingcheng4_nairong1'];
	$xingcheng4_type2=$_REQUEST['xingcheng4_type2'];
	$xingcheng4_nairong2=$_REQUEST['xingcheng4_nairong2'];
	$xingcheng4_type3=$_REQUEST['xingcheng4_type3'];
	$xingcheng4_nairong3=$_REQUEST['xingcheng4_nairong3'];
	$xingcheng4_type4=$_REQUEST['xingcheng4_type4'];
	$xingcheng4_nairong4=$_REQUEST['xingcheng4_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng4_biaoti','$xingcheng4_type1','$xingcheng4_nairong1','$xingcheng4_type3','$xingcheng4_nairong2','$xingcheng4_type3','$xingcheng4_nairong3','$xingcheng4_type4','$xingcheng4_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng4_biaoti',`tubiao_type1`='$xingcheng4_type1',`nairong1`='$xingcheng4_nairong1',`tubiao_type2`=$xingcheng4_type2,`nairong2`='$xingcheng4_nairong2',`tubiao_type3`='$xingcheng4_type3',`nairong3`='$xingcheng4_nairong3',`tubiao_type4`='$xingcheng4_type4',`nairong4`='$xingcheng4_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}

//提交第5天信息
if($bigtype==8){
	$id=$_REQUEST['id'];
	$day=5;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng5_biaoti=$_REQUEST['xingcheng5_biaoti'];
	$xingcheng5_type1=$_REQUEST['xingcheng5_type1'];
	$xingcheng5_nairong1=$_REQUEST['xingcheng5_nairong1'];
	$xingcheng5_type2=$_REQUEST['xingcheng5_type2'];
	$xingcheng5_nairong2=$_REQUEST['xingcheng5_nairong2'];
	$xingcheng5_type3=$_REQUEST['xingcheng5_type3'];
	$xingcheng5_nairong3=$_REQUEST['xingcheng5_nairong3'];
	$xingcheng5_type4=$_REQUEST['xingcheng5_type4'];
	$xingcheng5_nairong4=$_REQUEST['xingcheng5_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng5_biaoti','$xingcheng5_type1','$xingcheng5_nairong1','$xingcheng5_type3','$xingcheng5_nairong2','$xingcheng5_type3','$xingcheng5_nairong3','$xingcheng5_type4','$xingcheng5_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng5_biaoti',`tubiao_type1`='$xingcheng5_type1',`nairong1`='$xingcheng5_nairong1',`tubiao_type2`=$xingcheng5_type2,`nairong2`='$xingcheng5_nairong2',`tubiao_type3`='$xingcheng5_type3',`nairong3`='$xingcheng5_nairong3',`tubiao_type4`='$xingcheng5_type4',`nairong4`='$xingcheng5_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}

//提交第6天信息
if($bigtype==9){
	$id=$_REQUEST['id'];
	$day=6;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng6_biaoti=$_REQUEST['xingcheng6_biaoti'];
	$xingcheng6_type1=$_REQUEST['xingcheng6_type1'];
	$xingcheng6_nairong1=$_REQUEST['xingcheng6_nairong1'];
	$xingcheng6_type2=$_REQUEST['xingcheng6_type2'];
	$xingcheng6_nairong2=$_REQUEST['xingcheng6_nairong2'];
	$xingcheng6_type3=$_REQUEST['xingcheng6_type3'];
	$xingcheng6_nairong3=$_REQUEST['xingcheng6_nairong3'];
	$xingcheng6_type4=$_REQUEST['xingcheng6_type4'];
	$xingcheng6_nairong4=$_REQUEST['xingcheng6_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng6_biaoti','$xingcheng6_type1','$xingcheng6_nairong1','$xingcheng6_type3','$xingcheng6_nairong2','$xingcheng6_type3','$xingcheng6_nairong3','$xingcheng6_type4','$xingcheng6_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng6_biaoti',`tubiao_type1`='$xingcheng6_type1',`nairong1`='$xingcheng6_nairong1',`tubiao_type2`=$xingcheng6_type2,`nairong2`='$xingcheng6_nairong2',`tubiao_type3`='$xingcheng6_type3',`nairong3`='$xingcheng6_nairong3',`tubiao_type4`='$xingcheng6_type4',`nairong4`='$xingcheng6_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第7天信息
if($bigtype==10){
	$id=$_REQUEST['id'];
	$day=7;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng7_biaoti=$_REQUEST['xingcheng7_biaoti'];
	$xingcheng7_type1=$_REQUEST['xingcheng7_type1'];
	$xingcheng7_nairong1=$_REQUEST['xingcheng7_nairong1'];
	$xingcheng7_type2=$_REQUEST['xingcheng7_type2'];
	$xingcheng7_nairong2=$_REQUEST['xingcheng7_nairong2'];
	$xingcheng7_type3=$_REQUEST['xingcheng7_type3'];
	$xingcheng7_nairong3=$_REQUEST['xingcheng7_nairong3'];
	$xingcheng7_type4=$_REQUEST['xingcheng7_type4'];
	$xingcheng7_nairong4=$_REQUEST['xingcheng7_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng7_biaoti','$xingcheng7_type1','$xingcheng7_nairong1','$xingcheng7_type3','$xingcheng7_nairong2','$xingcheng7_type3','$xingcheng7_nairong3','$xingcheng7_type4','$xingcheng7_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng7_biaoti',`tubiao_type1`='$xingcheng7_type1',`nairong1`='$xingcheng7_nairong1',`tubiao_type2`=$xingcheng7_type2,`nairong2`='$xingcheng7_nairong2',`tubiao_type3`='$xingcheng7_type3',`nairong3`='$xingcheng7_nairong3',`tubiao_type4`='$xingcheng7_type4',`nairong4`='$xingcheng7_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第8天信息
if($bigtype==11){
	$id=$_REQUEST['id'];
	$day=8;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng8_biaoti=$_REQUEST['xingcheng8_biaoti'];
	$xingcheng8_type1=$_REQUEST['xingcheng8_type1'];
	$xingcheng8_nairong1=$_REQUEST['xingcheng8_nairong1'];
	$xingcheng8_type2=$_REQUEST['xingcheng8_type2'];
	$xingcheng8_nairong2=$_REQUEST['xingcheng8_nairong2'];
	$xingcheng8_type3=$_REQUEST['xingcheng8_type3'];
	$xingcheng8_nairong3=$_REQUEST['xingcheng8_nairong3'];
	$xingcheng8_type4=$_REQUEST['xingcheng8_type4'];
	$xingcheng8_nairong4=$_REQUEST['xingcheng8_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng8_biaoti','$xingcheng8_type1','$xingcheng8_nairong1','$xingcheng8_type3','$xingcheng8_nairong2','$xingcheng8_type3','$xingcheng8_nairong3','$xingcheng8_type4','$xingcheng8_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng8_biaoti',`tubiao_type1`='$xingcheng8_type1',`nairong1`='$xingcheng8_nairong1',`tubiao_type2`=$xingcheng8_type2,`nairong2`='$xingcheng8_nairong2',`tubiao_type3`='$xingcheng8_type3',`nairong3`='$xingcheng8_nairong3',`tubiao_type4`='$xingcheng8_type4',`nairong4`='$xingcheng8_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第9天信息
if($bigtype==12){
	$id=$_REQUEST['id'];
	$day=9;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng9_biaoti=$_REQUEST['xingcheng9_biaoti'];
	$xingcheng9_type1=$_REQUEST['xingcheng9_type1'];
	$xingcheng9_nairong1=$_REQUEST['xingcheng9_nairong1'];
	$xingcheng9_type2=$_REQUEST['xingcheng9_type2'];
	$xingcheng9_nairong2=$_REQUEST['xingcheng9_nairong2'];
	$xingcheng9_type3=$_REQUEST['xingcheng9_type3'];
	$xingcheng9_nairong3=$_REQUEST['xingcheng9_nairong3'];
	$xingcheng9_type4=$_REQUEST['xingcheng9_type4'];
	$xingcheng9_nairong4=$_REQUEST['xingcheng9_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng9_biaoti','$xingcheng9_type1','$xingcheng9_nairong1','$xingcheng9_type3','$xingcheng9_nairong2','$xingcheng9_type3','$xingcheng9_nairong3','$xingcheng9_type4','$xingcheng9_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng9_biaoti',`tubiao_type1`='$xingcheng9_type1',`nairong1`='$xingcheng9_nairong1',`tubiao_type2`=$xingcheng9_type2,`nairong2`='$xingcheng9_nairong2',`tubiao_type3`='$xingcheng9_type3',`nairong3`='$xingcheng9_nairong3',`tubiao_type4`='$xingcheng9_type4',`nairong4`='$xingcheng9_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第10天信息
if($bigtype==13){
	$id=$_REQUEST['id'];
	$day=10;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng10_biaoti=$_REQUEST['xingcheng10_biaoti'];
	$xingcheng10_type1=$_REQUEST['xingcheng10_type1'];
	$xingcheng10_nairong1=$_REQUEST['xingcheng10_nairong1'];
	$xingcheng10_type2=$_REQUEST['xingcheng10_type2'];
	$xingcheng10_nairong2=$_REQUEST['xingcheng10_nairong2'];
	$xingcheng10_type3=$_REQUEST['xingcheng10_type3'];
	$xingcheng10_nairong3=$_REQUEST['xingcheng10_nairong3'];
	$xingcheng10_type4=$_REQUEST['xingcheng10_type4'];
	$xingcheng10_nairong4=$_REQUEST['xingcheng10_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng10_biaoti','$xingcheng10_type1','$xingcheng10_nairong1','$xingcheng10_type3','$xingcheng10_nairong2','$xingcheng10_type3','$xingcheng10_nairong3','$xingcheng10_type4','$xingcheng10_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng10_biaoti',`tubiao_type1`='$xingcheng10_type1',`nairong1`='$xingcheng10_nairong1',`tubiao_type2`=$xingcheng10_type2,`nairong2`='$xingcheng10_nairong2',`tubiao_type3`='$xingcheng10_type3',`nairong3`='$xingcheng10_nairong3',`tubiao_type4`='$xingcheng10_type4',`nairong4`='$xingcheng10_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第11天信息
if($bigtype==14){
	$id=$_REQUEST['id'];
	$day=11;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng11_biaoti=$_REQUEST['xingcheng11_biaoti'];
	$xingcheng11_type1=$_REQUEST['xingcheng11_type1'];
	$xingcheng11_nairong1=$_REQUEST['xingcheng11_nairong1'];
	$xingcheng11_type2=$_REQUEST['xingcheng11_type2'];
	$xingcheng11_nairong2=$_REQUEST['xingcheng11_nairong2'];
	$xingcheng11_type3=$_REQUEST['xingcheng11_type3'];
	$xingcheng11_nairong3=$_REQUEST['xingcheng11_nairong3'];
	$xingcheng11_type4=$_REQUEST['xingcheng11_type4'];
	$xingcheng11_nairong4=$_REQUEST['xingcheng11_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng11_biaoti','$xingcheng11_type1','$xingcheng11_nairong1','$xingcheng11_type3','$xingcheng11_nairong2','$xingcheng11_type3','$xingcheng11_nairong3','$xingcheng11_type4','$xingcheng11_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng11_biaoti',`tubiao_type1`='$xingcheng11_type1',`nairong1`='$xingcheng11_nairong1',`tubiao_type2`=$xingcheng11_type2,`nairong2`='$xingcheng11_nairong2',`tubiao_type3`='$xingcheng11_type3',`nairong3`='$xingcheng11_nairong3',`tubiao_type4`='$xingcheng11_type4',`nairong4`='$xingcheng11_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交第12天信息
if($bigtype==15){
	$id=$_REQUEST['id'];
	$day=12;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng12_biaoti=$_REQUEST['xingcheng12_biaoti'];
	$xingcheng12_type1=$_REQUEST['xingcheng12_type1'];
	$xingcheng12_nairong1=$_REQUEST['xingcheng12_nairong1'];
	$xingcheng12_type2=$_REQUEST['xingcheng12_type2'];
	$xingcheng12_nairong2=$_REQUEST['xingcheng12_nairong2'];
	$xingcheng12_type3=$_REQUEST['xingcheng12_type3'];
	$xingcheng12_nairong3=$_REQUEST['xingcheng12_nairong3'];
	$xingcheng12_type4=$_REQUEST['xingcheng12_type4'];
	$xingcheng12_nairong4=$_REQUEST['xingcheng12_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng12_biaoti','$xingcheng12_type1','$xingcheng12_nairong1','$xingcheng12_type3','$xingcheng12_nairong2','$xingcheng12_type3','$xingcheng12_nairong3','$xingcheng12_type4','$xingcheng12_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng12_biaoti',`tubiao_type1`='$xingcheng12_type1',`nairong1`='$xingcheng12_nairong1',`tubiao_type2`=$xingcheng12_type2,`nairong2`='$xingcheng12_nairong2',`tubiao_type3`='$xingcheng12_type3',`nairong3`='$xingcheng12_nairong3',`tubiao_type4`='$xingcheng12_type4',`nairong4`='$xingcheng12_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}

//提交行程段落
if($bigtype==16){
	$id_zhishen_duanluo=$_REQUEST['id_zhishen_duanluo'];
	$id=$_REQUEST['id'];
	$difang_id=$_REQUEST['id'];
	
	$xingcheng_duanluo1=$_REQUEST['xingcheng_duanluo1'];
	$xingcheng_duanluo2=$_REQUEST['xingcheng_duanluo2'];
	$xingcheng_duanluo3=$_REQUEST['xingcheng_duanluo3'];
	$xingcheng_duanluo4=$_REQUEST['xingcheng_duanluo4'];
	
	//判断该用户是否存在
	if(strlen($id_zhishen_duanluo)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_duanluo`(`difang_id`, `xingcheng_dduanluo1`, `xingcheng_dduanluo2`, `xingcheng_dduanluo3`, `xingcheng_dduanluo4`) VALUES ('$difang_id','$xingcheng_duanluo1','$xingcheng_duanluo2','$xingcheng_duanluo3','$xingcheng_duanluo4')";
		$query = mysql_query($sql);		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_duanluo` SET `xingcheng_dduanluo1`='$xingcheng_duanluo1',`xingcheng_dduanluo2`='$xingcheng_duanluo2',`xingcheng_dduanluo3`='$xingcheng_duanluo3',`xingcheng_dduanluo4`='$xingcheng_duanluo4' WHERE difang_id='$difang_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//提交用户须知
if($bigtype==17){
	$id=$_REQUEST['difang_id'];
	$difang_id=$_REQUEST['difang_id'];
	$textarea=$_REQUEST['textarea'];
	$id_zhisheng_theer=$_REQUEST['id_zhisheng_theer'];
	
	if(strlen($id_zhisheng_theer)==0){
		$sql="INSERT INTO `yonghu_xvzhi`(`difang_id`, `textarea`) VALUES ('$difang_id','$textarea')";
		$query = mysql_query($sql);		
	}else{
		$sql="UPDATE `yonghu_xvzhi` SET `difang_id`='$difang_id',`textarea`='$textarea' WHERE id='$id_zhisheng_theer'";
		$query = mysql_query($sql);
	}
?>
	<SCRIPT LANGUAGE='javascript'> 
	window.location.href="index.php?id=<?php echo $id;?>"; 
	</SCRIPT>
<?php
}

// 上传目的介绍内容
if($bigtype==18){
	$id_mudi_duanluo=$_REQUEST['id_mudi_duanluo'];
	$id=$_REQUEST['id'];
	$difang_id=$_REQUEST['id'];
	
	$mudi_duanluo1=$_REQUEST['mudi_duanluo1'];
	$mudi_duanluo2=$_REQUEST['mudi_duanluo2'];
	$mudi_duanluo3=$_REQUEST['mudi_duanluo3'];
	$mudi_duanluo4=$_REQUEST['mudi_duanluo4'];

	
	if(strlen($id_mudi_duanluo)==0){
		$sql="INSERT INTO `mudi_duanluo`(`difang_id`, `mudi_duanluo1`, `mudi_duanluo2`, `mudi_duanluo3`, `mudi_duanluo4`) VALUES ('$difang_id','$mudi_duanluo1','$mudi_duanluo2','$mudi_duanluo3','$mudi_duanluo4')";
		$query = mysql_query($sql);		
	}else{
		$sql="UPDATE `mudi_duanluo` SET `difang_id`='$difang_id',`mudi_duanluo1`='$mudi_duanluo1',`mudi_duanluo2`='$mudi_duanluo2',`mudi_duanluo3`='$mudi_duanluo3',`mudi_duanluo4`='$mudi_duanluo4' WHERE id='$id_mudi_duanluo'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}

if($bigtype==19){
	$id=$_REQUEST['id'];
	
	$day_biaoshi=$_REQUEST['day_biaoshi'];//第几天
	$tupianmiaoshu11=$_REQUEST['tupianmiaoshu11'];//第几天的第一张图片描述
	$tupianmiaoshu12=$_REQUEST['tupianmiaoshu12'];//第几天的第二张图片描述
	$tupianmiaoshu13=$_REQUEST['tupianmiaoshu13'];//第几天的第三张图片描述

	//查询个张图片位置
	$i=1;
	$sql="SELECT * FROM `picture_day_info` WHERE difang_id='$id' and day='$day_biaoshi' and type='1' order by id";
	$query = mysql_query($sql);
	while($row = mysql_fetch_array($query)){
		if($i==1){
			$one_tupian_wzhi1=$row['id'];
		}
		if($i==2){
			$one_tupian_wzhi2=$row['id'];
		}
		if($i==3){
			$one_tupian_wzhi3=$row['id'];
		}
		$i++;
	}
		
	if(strlen($tupianmiaoshu11)>0){
		//更改第一张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu11' WHERE id='$one_tupian_wzhi1'";
		$query = mysql_query($sql);
	}
	if(strlen($tupianmiaoshu12)>0){
		//更改第二张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu12' WHERE id='$one_tupian_wzhi2'";
		$query = mysql_query($sql);
	}
	if(strlen($tupianmiaoshu13)>0){
		//更改第三张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu13' WHERE id='$one_tupian_wzhi3'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;


}


//提交第13天信息
if($bigtype==20){
	$id=$_REQUEST['id'];
	$day=13;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng13_biaoti=$_REQUEST['xingcheng13_biaoti'];
	$xingcheng13_type1=$_REQUEST['xingcheng13_type1'];
	$xingcheng13_nairong1=$_REQUEST['xingcheng13_nairong1'];
	$xingcheng13_type2=$_REQUEST['xingcheng13_type2'];
	$xingcheng13_nairong2=$_REQUEST['xingcheng13_nairong2'];
	$xingcheng13_type3=$_REQUEST['xingcheng13_type3'];
	$xingcheng13_nairong3=$_REQUEST['xingcheng13_nairong3'];
	$xingcheng13_type4=$_REQUEST['xingcheng13_type4'];
	$xingcheng13_nairong4=$_REQUEST['xingcheng13_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng13_biaoti','$xingcheng13_type1','$xingcheng13_nairong1','$xingcheng13_type3','$xingcheng13_nairong2','$xingcheng13_type3','$xingcheng13_nairong3','$xingcheng13_type4','$xingcheng13_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng13_biaoti',`tubiao_type1`='$xingcheng13_type1',`nairong1`='$xingcheng13_nairong1',`tubiao_type2`=$xingcheng13_type2,`nairong2`='$xingcheng13_nairong2',`tubiao_type3`='$xingcheng13_type3',`nairong3`='$xingcheng13_nairong3',`tubiao_type4`='$xingcheng13_type4',`nairong4`='$xingcheng13_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}

//提交第14天信息
if($bigtype==21){
	$id=$_REQUEST['id'];
	$day=14;
	$difang_id=$id;
	$muoban=1;
	$zisheng_id=$_REQUEST['zisheng_id'];
	
	$xingcheng14_biaoti=$_REQUEST['xingcheng14_biaoti'];
	$xingcheng14_type1=$_REQUEST['xingcheng14_type1'];
	$xingcheng14_nairong1=$_REQUEST['xingcheng14_nairong1'];
	$xingcheng14_type2=$_REQUEST['xingcheng14_type2'];
	$xingcheng14_nairong2=$_REQUEST['xingcheng14_nairong2'];
	$xingcheng14_type3=$_REQUEST['xingcheng14_type3'];
	$xingcheng14_nairong3=$_REQUEST['xingcheng14_nairong3'];
	$xingcheng14_type4=$_REQUEST['xingcheng14_type4'];
	$xingcheng14_nairong4=$_REQUEST['xingcheng14_nairong4'];
	
	//判断该用户是否存在
	if(strlen($zisheng_id)==0){
		//账号不存在，新增数据
		$sql="INSERT INTO `xingcheng_day_info`(`difang_id`, `day`, `biaoti`, `tubiao_type1`, `nairong1`, `tubiao_type2`, `nairong2`, `tubiao_type3`, `nairong3`, `tubiao_type4`, `nairong4`, `muoban`) VALUES ('$difang_id','$day','$xingcheng14_biaoti','$xingcheng14_type1','$xingcheng14_nairong1','$xingcheng14_type3','$xingcheng14_nairong2','$xingcheng14_type3','$xingcheng14_nairong3','$xingcheng14_type4','$xingcheng14_nairong4','1')";
		$query = mysql_query($sql);		
		
	}else{
		//账号存在，更新数据
		$sql="UPDATE `xingcheng_day_info` SET `difang_id`='$difang_id',`day`='$day',`biaoti`='$xingcheng14_biaoti',`tubiao_type1`='$xingcheng14_type1',`nairong1`='$xingcheng14_nairong1',`tubiao_type2`=$xingcheng14_type2,`nairong2`='$xingcheng14_nairong2',`tubiao_type3`='$xingcheng14_type3',`nairong3`='$xingcheng14_nairong3',`tubiao_type4`='$xingcheng14_type4',`nairong4`='$xingcheng14_nairong4' WHERE id='$zisheng_id'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}
//模板二，上传行程特色图片
if($bigtype==22){
	$id=$_REQUEST['id'];
	
	$tupianmiaoshu21=$_REQUEST['tupianmiaoshu21'];//第一张图片描述
	$tupianmiaoshu22=$_REQUEST['tupianmiaoshu22'];//第几天的第二张图片描述
	$tupianmiaoshu23=$_REQUEST['tupianmiaoshu23'];//第几天的第三张图片描述
	$tupianmiaoshu24=$_REQUEST['tupianmiaoshu24'];//第几天的第四张图片描述
	$tupianmiaoshu25=$_REQUEST['tupianmiaoshu25'];//第几天的第五张图片描述
	$tupianmiaoshu26=$_REQUEST['tupianmiaoshu26'];//第几天的第六张图片描述

	//查询个张图片位置
	$i=1;
	$sql="SELECT * FROM `picture_day_info` WHERE difang_id='$id' and  type='2' order by id";
	$query = mysql_query($sql);
	while($row = mysql_fetch_array($query)){
		if($i==1){
			$one_tupian_wzhi1=$row['id'];
		}
		if($i==2){
			$one_tupian_wzhi2=$row['id'];
		}
		if($i==3){
			$one_tupian_wzhi3=$row['id'];
		}
		if($i==4){
			$one_tupian_wzhi4=$row['id'];
		}
		if($i==5){
			$one_tupian_wzhi5=$row['id'];
		}
		if($i==6){
			$one_tupian_wzhi6=$row['id'];
		}
		$i++;
	}
		
	if(strlen($tupianmiaoshu21)>0){
		//更改第一张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu21' WHERE id='$one_tupian_wzhi1'";
		$query = mysql_query($sql);
	}
	if(strlen($tupianmiaoshu22)>0){
		//更改第二张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu22' WHERE id='$one_tupian_wzhi2'";
		$query = mysql_query($sql);
	}
	if(strlen($tupianmiaoshu23)>0){
		//更改第三张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu23' WHERE id='$one_tupian_wzhi3'";
		$query = mysql_query($sql);
	}
	if(strlen($tupianmiaoshu24)>0){
		//更改第一张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu24' WHERE id='$one_tupian_wzhi4'";
		$query = mysql_query($sql);
	}
	if(strlen($tupianmiaoshu25)>0){
		//更改第二张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu25' WHERE id='$one_tupian_wzhi5'";
		$query = mysql_query($sql);
	}
	if(strlen($tupianmiaoshu26)>0){
		//更改第三张图片内容
		$sql="UPDATE `picture_day_info` SET `picture_miaoshu`='$tupianmiaoshu26' WHERE id='$one_tupian_wzhi6'";
		$query = mysql_query($sql);
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"id\"".":"."\"".$id."\",";
	echo "\"reason\"".":"."\""."该用户的数据上传成功！"."\"";
	echo "}";
	exit;
}

if($bigtype==23){
	$biaoqian=$_REQUEST['biaoqian'];
	$id=$_REQUEST['id'];
	
	$_SESSION['bigtype']=$biaoqian;
	?>
	<SCRIPT LANGUAGE='javascript'> 
	window.location.href="index.php?id=<?php echo $id;?>"; 
	</SCRIPT>
	<?php
}
//赠与驴币
if($bigtype==24){

	echo "赠与驴币已屏蔽";exit;
	
	$openid=$_REQUEST['openid'];
	$how_much=$_REQUEST['how_much'];
	$beizhu=$_REQUEST['beizhu'];
	//if((int)$how_much<0){

	$sql="update `ecs_users` set pay_points=pay_points+($how_much) where openid='$openid'";
	$query = mysql_query($sql);
	
	$sql="INSERT INTO `lvbi_huoqv`(`openid`, `huoqv_tujing`, `how_much`) VALUES ('$openid','后台赠与：$beizhu','$how_much')";
	$query = mysql_query($sql);
	
	echo "{";
	echo "\"code\"".":"."\"0001\"";
	echo "}";
	exit;
	
}
if($bigtype==25){
	$time=$_REQUEST['time'];
	$xiangmu=$_REQUEST['xiangmu'];
	$banqi=$_REQUEST['banqi'];
	$is_zhifu=$_REQUEST['is_zhifu'];
	
	$_SESSION['time']=$time;
	$_SESSION['xiangmu']=$xiangmu;
	$_SESSION['banqi']=$banqi;
	$_SESSION['is_zhifu']=$is_zhifu;

	//打印
	if($_REQUEST['down_print']==2)$where="?down_print=2";
	
	echo "<script>window.location.href='dingdan_info.php$where';</script>";
}
//获取班期
else if($bigtype==26){
	$xiangmu=$_REQUEST['xiangmu'];
	
	$sql="SELECT * FROM `lvyou_difang_info` WHERE id='$xiangmu'";
	$query = mysql_query($sql);
	while($row = mysql_fetch_array($query)){
		$banqi1=$row['banqi1'];
		$banqi2=$row['banqi2'];
		$banqi3=$row['banqi3'];
	}
	
	echo "{";
	echo "\"code\"".":"."\"0001\",";
	echo "\"banqi1\"".":"."\"".$banqi1."\",";
	echo "\"banqi2\"".":"."\"".$banqi2."\",";
	echo "\"banqi3\"".":"."\"".$banqi3."\"";
	echo "}";
	exit;
}
//删除订单曹卓
else if($bigtype==27){
	$id=$_REQUEST['id'];
	
	$sql="DELETE FROM `main_user` WHERE id_self='$id'";
	$query = mysql_query($sql);
	
	echo "<script>window.location.href='dingdan_info.php';</script>";
}
//修改状态
else if($bigtype==28){
	$id=$_REQUEST['id'];
	$zhifu_zhuangtai=$_REQUEST['zhifu_zhuangtai'];

   
    //查看订单状态
	$sql="SELECT openid,id_difang,is_zhifu FROM `main_user` WHERE id_self='".$id."'";
    $query = mysql_query($sql);
    $row = mysql_fetch_array($query);
    $openid=$row[0];
    $id_difang=$row[1];
    $is_zhifu=$row[2];



	
	$now_time=time(); 
    $sql="SELECT user_id,user_name FROM `ecs_users` WHERE openid='".$openid."'";
	$query = mysql_query($sql);
	$row = mysql_fetch_array($query);
	$user_id=$row[0];
	$user_name=$row[1];
	
	

	/*****************zhsk分享赠送驴币**********************/
	if($is_zhifu==1 && $zhifu_zhuangtai!==1)//支付状态转为其他状态
	{

	    //获取用户应得的驴币id_difang
		$sql="select * from `lvyou_difang_info` where id='$id_difang'";
		$query = mysql_query($sql);
		while($row = mysql_fetch_array($query)){
			$fanduos=$row['fanduos'];
		}
		//记录下驴币使用情况
		// $sql="INSERT INTO `lvbi_huoqv`(`openid`, `huoqv_tujing`, `how_much`, `id_difang`) VALUES ('$openid','取消支付订单','-$fanduos','$id_difang')";
		// $query = mysql_query($sql);		    	
		//订单日志
		if($fanduos>0)
		{
			$sql="insert into ecs_account_log(`user_id`,`pay_points`,`change_time`,`change_desc`,`change_type`,`user_money`,`frozen_money`,`rank_points`)  values('".$user_id."','-$fanduos','$now_time','".$user_name."后台取消支付，订单".$id."','99',0,0,'-$fanduos')";
	        $query = mysql_query($sql);			
		}
		//返回订单赠与的驴币
		$sql="UPDATE `ecs_users` SET `pay_points`=pay_points-$fanduos,`rank_points`=rank_points-$fanduos where openid='$openid'";
		$query = mysql_query($sql);
		////////////////////////////////////////////////////////////////////////////////////////////


		$sql="SELECT share_id,status,user_pid FROM `ecs_share_url` WHERE openid='".$openid."' and id_difang='$id_difang'";
	    $query = mysql_query($sql);

	    $row = mysql_fetch_array($query);
	    $share_id=$row[0];
	    $status=$row[1];
	    $user_pid=$row[2];
	    if($status==2)
	    {
			$sql="SELECT user_id,user_name FROM `ecs_users` WHERE openid='".$openid."'";
		    $query = mysql_query($sql);
		    $row = mysql_fetch_array($query);
		    if($row)
		    {

				$add_pay_points=10;
		    	//日志
				$sql="insert into ecs_account_log(`user_id`,`pay_points`,`change_time`,`change_desc`,`change_type`,`user_money`,`frozen_money`,`rank_points`)  values('$user_pid',-'$add_pay_points','$now_time','".$row[1]."报名后台取消，返回驴币，订单".$id."','99',0,0,-'$add_pay_points')";
			    $query = mysql_query($sql);
			    //赠送驴币
			    $sql="update ecs_users set pay_points=pay_points-".$add_pay_points.",rank_points=rank_points-".$add_pay_points." where user_id='$user_pid'";
			    $query = mysql_query($sql);
			    
			    $sql="UPDATE `ecs_share_url` SET `status`=1 where share_id='$share_id'";
				$query = mysql_query($sql);

		    }    	
	    }
	}
	else if($is_zhifu!=1 && $zhifu_zhuangtai==1)//其他状态转为支付状态
	{
		//获取用户应得的驴币id_difang
		$sql="select * from `lvyou_difang_info` where id='$id_difang'";
		$query = mysql_query($sql);
		while($row = mysql_fetch_array($query)){
			$fanduos=$row['fanduos'];
		}
		// //记录下驴币使用情况
		// $sql="INSERT INTO `lvbi_huoqv`(`openid`, `huoqv_tujing`, `how_much`, `id_difang`) VALUES ('$openid','后台支付订单成功','$fanduos','$id_difang')";
		// $query = mysql_query($sql);

		//订单日志
		if($fanduos>0)
		{
			$sql="insert into ecs_account_log(`user_id`,`pay_points`,`change_time`,`change_desc`,`change_type`,`user_money`,`frozen_money`,`rank_points`)  values('".$user_id."','$fanduos','$now_time','".$user_name."后台支付订单成功,获得驴币,订单".$id."','99',0,0,'$fanduos')";
	        $query = mysql_query($sql);				
		}


		//返回订单赠与的驴币
		$sql="UPDATE `ecs_users` SET `pay_points`=pay_points+$fanduos,`rank_points`=rank_points+$fanduos where openid='$openid'";
		$query = mysql_query($sql);
		////////////////////////////////////////////////////////////////////////////////////////////


		$sql="SELECT share_id,status,user_pid FROM `ecs_share_url` WHERE openid='".$openid."' and id_difang='$id_difang'";
	    $query = mysql_query($sql);

	    $row = mysql_fetch_array($query);
	    $share_id=$row[0];
	    $status=$row[1];
	    $user_pid=$row[2];
	    if($status==1)
	    {
			$sql="SELECT user_id,user_name FROM `ecs_users` WHERE openid='".$openid."'";
		    $query = mysql_query($sql);
		    $row = mysql_fetch_array($query);
		    if($row)
		    {
				$add_pay_points=10;
				



		    
		    	//日志
				$sql="insert into ecs_account_log(`user_id`,`pay_points`,`change_time`,`change_desc`,`change_type`,`user_money`,`frozen_money`,`rank_points`)  values('$user_pid','$add_pay_points','$now_time','".$row[1]."后台报名，用户分享获得驴币，订单".$id."','99',0,0,'$add_pay_points')";
			    $query = mysql_query($sql);
			    //赠送驴币
			    $sql="update ecs_users set pay_points=pay_points+".$add_pay_points.",rank_points=rank_points+".$add_pay_points." where user_id='$user_pid'";
			    $query = mysql_query($sql);
			    
			    $sql="UPDATE `ecs_share_url` SET `status`=2 where share_id='$share_id'";
				$query = mysql_query($sql);

		    }    	
	    }
	}
	
    /*****************zhsk分享赠送驴币**********************/


    $sql="update `main_user` set is_zhifu='$zhifu_zhuangtai' WHERE id_self='$id'";
	$query = mysql_query($sql);

    echo "<script>window.location.href='dingdan_info.php';</script>";
}

//查询旅途 地区
else if($bigtype==29){
	$dtype=$_REQUEST['dtype']?intval($_REQUEST['dtype']):1;
	$sql="SELECT difang_type_id as id,difang_type_name as name FROM `lvyou_difang_type` WHERE parent_id='".$dtype."'";
	$query = mysql_query($sql);
	$type_list=array();
	while($row = mysql_fetch_array($query))
	{
		$ty_ar=array();
		$ty_ar['id']=$row['id'];
		$ty_ar['name']=$row['name'];
		$type_list[]=$ty_ar;
	}
	
	$data=array();
	$data['code']='001';
	$data['data']=$type_list;
	
	
	echo json_encode($data);
	exit;
	
}
?>


